log using datageneration1tannachong
insheet using "R:\wts\mywork\MIDDyadic_v3.10.csv", clear
sort (ccodea ccodeb) styear
generate lowconflict=0
replace lowconflict=1 if hiacta<13 & hiactb<13
egen cum_amount=sum(lowconflict), by (ccodea ccodeb)
by ccodea: gen lag1=lowconflict[_n-1]
by ccodea: gen lag2=lowconflict[_n-2]
by ccodea: gen lag3=lowconflict[_n-3]
by ccodea: gen lag4=lowconflict[_n-4]
by ccodea: gen lag5=lowconflict[_n-5]
egen cum_lag=sum(lag1+lag2+lag3+lag4+lag5), by(ccodea ccodeb)
merge m:m (ccodea styear) using R:\wts\mywork\dissertation\controlvar12.dta, keepusing (growth govtunpop)
rename _merge _merge12
merge m:m (ccodea styear) using R:\wts\mywork\dissertation\controlvar3.dta, keepusing (polity)
rename _merge _merge3
drop if styear<1992
drop if styear>2001
drop if dispnum==.
edit
sort (ccodea ccodeb) styear
log close
